package org.yuangu.privacyfinance.activities.adapter;

import org.yuangu.privacyfinance.domain.FinanceDatabase;
import org.yuangu.privacyfinance.domain.model.Category;

import androidx.lifecycle.LiveData;

public class CategoryWrapper implements IdProvider {
    private Category       category;
    private LiveData<Long> balance;

    public void setCategory(Category category) {
        this.category = category;
    }

    public void setBalance(LiveData<Long> balance) {
        this.balance = balance;
    }

    public CategoryWrapper(Category category) {
        this.category = category;
        balance = FinanceDatabase.getInstance().transactionDao().sumForCategoryThisMonth(category.getId());
    }

    public LiveData<Long> getBalance() {
        return balance;
    }

    @Override
    public Long getId() {
        return category.getId();
    }

    public Category getCategory() {
        return category;
    }
}
